﻿using System.Collections.Generic;

namespace SEVDNUG.Web.Sitefinity.Tools.DataImporter
{
    /// <summary>
    /// This class contains the results of the data import.
    /// </summary>
    public class Results
    {
        #region Properties
        /// <summary>
        /// Gets or sets the total failed records.
        /// </summary>
        /// <value>The total failed records.</value>
        public int TotalFailedRecords { get; set;}
        /// <summary>
        /// Gets or sets the total imported records.
        /// </summary>
        /// <value>The total imported records.</value>
        public int TotalImportedRecords { get; set; }
        /// <summary>
        /// Gets or sets the total records.
        /// </summary>
        /// <value>The total records.</value>
        public int TotalRecords { get; set; }
        /// <summary>
        /// Gets or sets the <see cref="ImportException"/>.
        /// </summary>
        /// <value>The <see cref="ImportException"/>.</value>
        public List<ImportException> ImportExceptions { get; set; }
        #endregion Properties

        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="Results"/> class.
        /// </summary>
        public Results()
        {
            ImportExceptions = new List<ImportException>();
        }
        #endregion Constructors

        #region Public Methods

        /// <summary>
        /// Adds an <see cref="Results"/> to this copy.
        /// </summary>
        /// <param name="results">The results.</param>
        public void AddTo(Results results)
        {
            TotalFailedRecords += results.TotalFailedRecords;
            TotalImportedRecords += results.TotalImportedRecords;
            TotalRecords += results.TotalRecords;
            ImportExceptions.AddRange(results.ImportExceptions);
        }
        #endregion Public Methods

    }
}
